// import type { App } from 'vue';
import { createPinia } from 'pinia';
import { useStoreApp } from './modules/app';
import { useStoreUser } from './modules/user';
import { useStoreCache } from './modules/cacheViews';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';

export { useStoreUser, useStoreCache, useStoreApp };

export function useStore() {
  return {
    app: useStoreApp(),
    user: useStoreUser(),
    cacheView: useStoreCache(),
  };
}

// const store = createPinia();
// export function setupStore(app: App<Element>) {
//   app.use(store);
// }
// export { store };

export default createPinia().use(piniaPluginPersistedstate);
